package com.kitty.syn;

import java.util.Iterator;
import java.util.List;

public class SecondRunnable implements Runnable {

private List<String> list;
private int size;	
private Runnable runnable;
	public SecondRunnable(List<String> list,int size,Runnable runnable) {
		this.list = list;
		this.size = size;
		this.runnable = runnable;
	}
	
	public void run() {
		System.out.println("secondRunnable...");
		/*
		for (int i = 0; i < this.size; i++) {
			this.list.add("second:" + i);
			System.out.println("second:" + i + this.list);
			 
		}
		*/
		while (true) {
			if (this.list.size() != 0) {
				this.list.clear();
				System.out.println("second:" + this.list);
			} else {
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
	}
	
	public String toString() {
		return this.list.toString();
	}
	
}
